package com.demo.scenic.controller;

import com.demo.scenic.common.BaseResponse;
import com.demo.scenic.service.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "upload")
@RestController
@RequestMapping("/upload")
@AllArgsConstructor
public class UploadController {
    private final UploadService uploadService;

    @PostMapping("/uploadImage")
    @ApiOperation(value = "上传图片", notes = "上传图片")
    public BaseResponse uploadImage(@RequestBody MultipartFile file) throws Exception {
        return uploadService.uploadImage(file);
    }
}
